﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Common;

namespace Print
{
    public partial class List : PrintPageBase
    {
        private PBLL.PMenu bllMenu = new PBLL.PMenu();
        private PBLL.PNews bllNews = new PBLL.PNews();
        public string mid = "1";
        public string id = "0";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    Response.Redirect(config.P_WebPath);
                }
                id = Request.QueryString["id"].ToString();
                bllNews.ExSql("update P_News set NHit=NHit+1 where Id=" + id);
                BaseRpt.DataSource = bllMenu.GetList("AShow=true");
                OleDbDataReader dr = bllMenu.GetDr("MUrl='news.aspx'");
                if (dr.Read())
                {
                    GetAd(AdRpt, dr["MTitle"].ToString());
                    mid = dr["Id"].ToString();
                    bTit.InnerHtml = "<strong>" + dr["MTitle"].ToString() + "</strong> <span class=\"soft\">" + dr["MEn"].ToString() + "</span>";
                }
                dr.Close();
                dr = bllNews.GetDr(id);
                if (dr.Read())
                {
                    Page.Header.Title = dr["NTitle"].ToString() + "-" + config.P_Name;
                    detials.InnerHtml += "<div class=\"mainbox-news-title\"><h2>" + dr["NTitle"].ToString() + "</h2></div>\n<div class=\"news-hr\"></div>";
                    detials.InnerHtml += "<div class=\"news-content-title2\">发布时间：" + ((DateTime)dr["NTime"]).ToShortDateString() + "&nbsp;&nbsp;点击量：" + dr["NHit"].ToString() + "</div>\n" + dr["NCont"].ToString();
                }
                dr.Close();
            }
        }
    }
}